<template>
  <div>
    <!--<TopFilter :list="topFilterList" :cols="3" @filterChange="changeHandle"></TopFilter>-->

    <FilterTable
      ref="table"
      height="300"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :uidkey="'dealerCode'"
      :onSyncTableData="tableChangeFun"
      :isSelectColumn="false"
      :onColumnsChange="columns => (this.columns = columns)"
    >
      <!--:onPageChange="handleTablePageChange"-->
    </FilterTable>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'center'
      }"
    >
      <el-button @click="closeDialog">关 闭</el-button>
    </div>
  </div>
</template>
<script>
import { queryFrostLog } from '@/api/omFinance/RebateManage/RebatePoolQuery';
import { dictionary } from '@/utils/dictMixin';
import { arrayObjDeWeight } from '@/utils';

export default {
  props: ['rowData'],
  data() {
    // this.tables = null;
    return {
      topFilterList: this.createdFrom(),
      columns: this.createdTable(),
      fetchParams: {id:this.rowData.id },
      appId: 'beijing',
      fetchApi: queryFrostLog,
      // selectedRow: [], // 选中的行项目
      totalArrList: [], // 选中的打印项目
      pageSelectRows: [], // 当前页选中的行项(过滤取消勾选项用)
      tableList: []
    };
  },
  mounted() {
    // this.tables = this.$refs.tables.$refs.pageTable;
  },
  mixins: [dictionary],
  methods: {
    // table数据变化
    tableChangeFun(val) {
      //页面数据变化重新赋值选中行项
      // this.selectedRow = val.filter(item => !!this.totalArrList.find(x => x.dealerCode == item.dealerCode));
      // console.log(this.selectedRow, '页面数据变化重新赋值选中行项');
    },
    // table页码变化
    handleTablePageChange(e) {
      this.pageSelectRows = [];
    },
    createdFrom() {
      return [
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'dealerCode',
          placeholder: '请选择'
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'dealerName',
          placeholder: '请选择'
        }
      ];
    },
    createdTable() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          fixed: 'left',
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '经销商代码',
          dataIndex: 'dealerCode',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '经销商简称',
          dataIndex: 'dealerName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '冻结金额',
          dataIndex: 'frostAmount',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '返利名称',
          dataIndex: 'accountTypeName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '备注',
          dataIndex: 'remark',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '操作人',
          dataIndex: 'createdName',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '操作时间',
          dataIndex: 'createdAt',
          sorter: true,
          filter: true,
          filterType: 'input'
        }
      ];
    },
    changeHandle(val) {
      this.fetchParams = Object.assign({}, this.fetchParams, val);
    },
    closeDialog() {
        this.$emit('close');
    }
  }
};
</script>
